﻿namespace System.ComponentModel.DataAnnotations.Schema
{
    using System;
    using System.Data.Entity.Utilities;
    using System.Globalization;

    [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
    /// <summary>
    /// When this attribute is placed on a class it indicates that the database table to which the
    /// class is mapped is a full-text indexed table.
    /// </summary>
    public class FullTextIndexedTableAttribute : Attribute
    {
        #region Fields

        private const string _prefix = Utilities.DefaultFunctionPrefix;
        //private readonly string _defaultSchema = Utilities.DefaultSchema;
        private readonly string _name;

        #endregion

        public FullTextIndexedTableAttribute()
        { }

        internal FullTextIndexedTableAttribute(string name)
        {
            this._name = name;
        }

        public string Name { get { return _name; } }
        public string Prefix { get { return _prefix; } }
        public string QualifiedFunctionName
        {
            get
            {
                return string.Format(CultureInfo.InvariantCulture, "{0}.{1}{2}",
                  "dbo",//Utilities.DefaultSchema,
                  _prefix,
                  _name);
            }
        }
    }
}
